<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>javaScript编写位置</title>
</head>
<body>
  <!--1: 编写位置: 在html内部-->
  <a href="#" onclick="alert('百度一下')">百度一下</a>
  <!--2: 编写位置: 在script元素内部-->
  <script>
    alert("Hellow World")
  </script>
  <a class="google" href="#"> Google</a>
  <script>
    var googleAE1 = document.querySelector(".google")
    googleAE1.onclick = function(){
      alert("google 搜索")
    }
  </script>
  <!--3: 编写位置: 从外部文件引入-->
  <a class="bing" href="#">bing搜索</a>
  <script src="../js/bing.js"></script>
</body>
</html>